﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace HDJ.Framework.Core.Editor
{
    public class GridData
    {
        /// <summary>
        /// 所有格子的数据
        /// </summary>
        //public List<List<object>> allGridDatas = new List<List<object>>();
        /// <summary>
        /// 每一列的宽度
        /// </summary>
        public List<float> withItemList = new List<float>();
        /// <summary>
        /// 每一行的高度
        /// </summary>
        public List<float> heightItemList = new List<float>();
        /// <summary>
        /// 可显示的所有行
        /// </summary>
        public List<int> currentShowAllRow = new List<int>();

        /// <summary>
        /// 固定可显示的所有行
        /// </summary>
        public List<int> fixedShowAllRow = new List<int>();
        /// <summary>
        /// 搜索可显示的所有行
        /// </summary>
        public List<int> searchShowAllRow = new List<int>();

        /// <summary>
        /// 选择的列
        /// </summary>
        public List<int> selectColumnIndexs = new List<int>();
        /// <summary>
        /// 选择的行
        /// </summary>
        public List<int> selectRowIndexs = new List<int>();

        public float defaltGridItemWith;
        public float defaltGridItemHeight;
        public  GridData(float defaltGridItemWith,float defaltGridItemHeight)
        {
            //this.allGridDatas = allGridDatas;
            this.defaltGridItemWith = defaltGridItemWith;
            this.defaltGridItemHeight = defaltGridItemHeight;

            //if (allGridDatas.Count > 0)
            //{
            //    for (int i = 0; i < allGridDatas[0].Count; i++)
            //    {
            //        withItemList.Add(defaltGridItemWith);
            //    }
            //}
            //for (int i = 0; i < allGridDatas.Count; i++)
            //{
            //    heightItemList.Add(defaltGridItemHeight);
            //}
        }

        //public Vector2 GetShowContentGUISize()
        //{
        //    float tempWith = 0;
        //    for (int i = 0; i < withItemList.Count; i++)
        //    {
        //        tempWith += withItemList[i];
        //    }
        //    // tempWith += ;

        //    float tempHeight = 0;
        //    foreach (var index in currentShowAllRow)
        //    {
        //        if(index< heightItemList.Count)
        //        {
        //            tempHeight += heightItemList[index];
        //        }
        //        else
        //        {
        //            Debug.LogError("currentShowRow 越界：" + index);
        //        }
        //    }
        //    // tempHeight += wHeight;
        //    return new Vector2(tempWith, tempHeight);
        //}
        /// <summary>
        /// 添加列
        /// </summary>
        public void AddColumn()
        {
            withItemList.Add(defaltGridItemWith);
        }
        /// <summary>
        /// 添加行
        /// </summary>
        public void AddRow()
        {
            heightItemList.Add(defaltGridItemHeight);
        }

    }

   

}
